package leetcode.code0942;

import leetcode.IDebug;
import leetcode.helper.H;

public class Solution implements IDebug {

	public int[] diStringMatch(String s) {
		char[] cs = s.toCharArray();
		int len = cs.length;
		int[] ans = new int[len + 1];
		int l = 0, r = len;
		for (int i = 0; i < len; i++) {
			if (cs[i] == 'I') {
				ans[i] = l++;
			} else {
				ans[i] = r--;
			}
		}
		ans[len] = l;
		return ans;
	}

	@Override
	public void debug4() {
		H.compare(getClass(), getClass());

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug4();
	}

}
